package yh;

/**
 * @Auther:云尚学Java
 *
 * 案例3：双重for循环：等腰三角形
 */
public class ForDemo5 {
    public static void main(String[] args) {
        int hang=4;
        int kongGe=(hang*2-1)/2;
        int kongGe2=(hang*2-1)/2+2;
        for (int i = 1; i <= hang; i++) {
            //System.out.println(i+"行");
            for(int j=1;j<=hang*2-1;j++){
                if(j<=kongGe||j>=kongGe2){
                    System.out.print(" ");
                }else {
                    System.out.print("*");
                }
            }
            kongGe--;
            kongGe2++;
            System.out.println();
        }
    }
}
